<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>

<!DOCTYPE HTML>
<html style='height:100%;'>
<head>
<base href="<%=basePath%>">

<title>待审批列表</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link rel="stylesheet" href="css/vivo.css">
<link rel="stylesheet" href="css/common.css">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="js/bootstrap2/css/bootstrap.min.css">
<link rel="stylesheet" href="js/bootstrap2/css/bootstrap-table.css">
<link rel="stylesheet" href="js/font-awesome/css/font-awesome.css">
<link href="js/select2/select2.min.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" type="text/css"
	href="static/p_house/house_index.css" />
<link rel="stylesheet" type="text/css"
	href="js/webuploader-0.1.5/webuploader.css" />

<script src="js/jquery-1.11.1.js"></script>
<script src="js/bootstrap2/js/bootstrap.min.js"></script>
<script src="js/bootstrap2/js/bootstrap-table.js"></script>
<script src="js/bootstrap2/js/bootstrap-table-zh-CN.js"></script>
<script type="text/javascript" src="js/layui-v2.1.5/layui/layui.all.js"></script>
<script type="text/javascript" src="<%=basePath%>js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="js/webuploader-0.1.5/webuploader.js"></script>
<script type="text/javascript" src="js/sharefunction.js"></script>
<script type="text/javascript" src="js/form.js"></script>
<script src="js/select2/select2.min.js"></script>
<!-- 图片放大 -->
<script src="js/postbird-img-glass/postbird-img-glass.js"></script>
</head>

<body style='height:100%'>
	<!-- 列表start -->
	<div style="padding-top: 5px;">
		<table id="table">

		</table>
	</div>
	<!-- 列表end -->
	<!-- 表单start -->
	<div id="show" hidden="hidden" style="margin-top: 15px;height:445px">
		<iframe id="toShow" name="toShow" width="100%" style="height:100%;" frameborder="0"></iframe>
	</div>
	<!-- 表单end -->
	<script type="text/javascript">
	
		function openDetail(url) {
			$("#show").show();
			$("iframe[id='toShow']").attr("src", url);
		}
		
		//日期格式化
		function dataFormat(value, row, index) {
			return new Date(row.approvalTime).format("yyyy-MM-dd");
		}
		var approvalState;
		$(function() {
			approvalState='${approvalState}';
			//初始化表格,动态从服务器加载数据  
			$("#table").bootstrapTable({
				method : "post", //使用get请求到服务器获取数据  
				url : "customerInfo/getPendingList", //获取数据的Servlet地址  
				striped : true, //表格显示条纹  
				pagination : true, //启动分页  
				pageSize : 10, //每页显示的记录数  
				pageNumber : 1, //当前第几页  
				pageList : [ 5, 10, 15, 20, 25 ], //记录数可选列表  
				sidePagination : "server", //表示服务端请求  
				contentType : 'application/x-www-form-urlencoded',
				//设置为undefined可以获取pageNumber，pageSize，searchText，sortName，sortOrder  
				//设置为limit可以获取limit, offset, search, sort, order  
				queryParamsType : "undefined",
				queryParams : function queryParams(params) { //设置查询参数  
					var param = {
						pageNumber : params.pageNumber,
						pageSize : params.pageSize,
						approvalState:approvalState
						
					};
					return param;
				},
				columns : [ 
				 {
					field : 'userName',
					title : '提交人',
				}, {
					field : 'approvalName',
					title : '审批人',
				}, {
					field : 'approvalTime',
					title : '提交时间',
					formatter:'dataFormat'
				}, {
					field : 'editRemark',
					title : '提交原因',
				} , {
					field : 'approvalRemark',
					title : '审批意见',
				},{
					field : 'opr',
					title : '操作',
					width : '15%',
					formatter : 'actionFormatter'
				} ]
			});
		
		});
		
		//表格-操作 - 格式化 
		function actionFormatter(value, row, index) {
			var html="";
			if(approvalState==2){
				//html="<a class='btn btn-info' href='"+row.controllerUrl+"'>审批</a>";
				html="<a class='btn btn-info' onClick='openDetail(\"" + row.controllerUrl + "\")'>审批</a>";
			}else if(approvalState==0){
				//html="--";
				html="<a class='btn btn-info' onClick='openDetail(\"examineInfo/toHistoryChangeList/?ctrlUrl="+row.controllerUrl+"&apId="+row.id+"\")'>查看</a>";
			}
			return html;
		
		}
		
	</script>
</body>
</html>
